<?php

use App\Models\Business;
use App\Models\Role;
use Illuminate\Database\Seeder;

class BusinessTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //随机生成项目
        $faker = app(Faker\Generator::class);
        $businessCount = 60;
        $categoryIds = [1,2,3,4,5];
        $units = ['万','百分比','分'];
        $cycles = ['月','季度','半年','年'];
        for ($index = 1; $index < $businessCount; $index++) {
            $business= Business::create([
                'name' => '项目'.$index,
                'description' => $faker->sentence,
                'is_statistical' => true,
                'is_enable' => true,
                'category_id' => array_random($categoryIds),
                'unit' => array_random($units),
                'data_cycle' => array_random($cycles)
            ]);

        }
    }
}
